#ifndef USERSESSION_H
#define USERSESSION_H
#include <QString>

class UserSession
{
public:
    static UserSession &getInstance()
    {
        static UserSession instance;
        return instance;
    }

    void setUserId(int id) { userId = id; }

    int getUserId() const { return userId; }

    void setUsername(const QString &name) { username = name; }

    QString getUsername() const { return username; }

private:
    UserSession() {} // 构造函数私有化，防止外部创建实例
    ~UserSession() {}

    UserSession(const UserSession &) = delete;
    UserSession &operator=(const UserSession &) = delete;

    int userId = -1; // 初始默认值为 -1，表示用户未登录
    QString username;
};

#endif // USERSESSION_H
